<template>
	<view class="company-file-details">
		<bs-navbar title='山东省淄博市散装…'></bs-navbar>
		<view class="big-title mb-20">
			{{details.recordName}}
		</view>
		<view class="content-text mb-50">
			{{details.companyAddress}}
		</view>
		<view class="mb-40">
			<u-image border-radius='12' :fade="true" duration="450" width="100%" height="386rpx" :src="details.titleImage"></u-image>
		</view>
		<view class="mb-70">
			<bsTitleRich title='企业简介' :content='details.education'></bsTitleRich>
		</view>
		<view class="mb-70">
			<bsTitleRich title='主营业务' :content='details.workExperience' :imgUrl='details.workImg'></bsTitleRich>
		</view>
		<bsCodeImg :imgUrl='codeImg' title='二维码'></bsCodeImg>
		<bsWorksListShow :list='details.production'></bsWorksListShow>
		<bsShare></bsShare>
	</view>
</template>

<script>
	import bsTitleRich from '@/components/bs-title-rich/bs-title-rich.vue'
	import bsCodeImg from '@/components/bs-code-img/bs-code-img.vue'
	import bsWorksListShow from '@/components/bs-works-list-show/bs-works-list-show.vue'
	import bsShare from '@/components/bs-share/bs-share.vue'
	import {
		baseImgUrl
	} from '@/config/config.js'
	export default {
		components: {
			bsTitleRich,
			bsCodeImg,
			bsWorksListShow,
			bsShare
		},
		data() {
			return {
				details: {},
				recordId: '',
				codeImg: '',
				imgUrl: this.configImgUrl
			};
		},
		async onLoad(e) {
			console.log(e,'????')
			if (e.recordId) {
				this.recordId = e.recordId
				await this.init()
			}
		},
		onShareAppMessage(res) {
			return {
				title: this.details.recordName + '的档案详情',
			}
		},
		methods: {
			async getCodeImg() {
				let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
				let curRoute = routes[routes.length - 1].route
				let res = await this.$u.api.getPageCode({
					page: curRoute,
					scene: 'recordId=' + this.recordId
				})
				this.codeImg = baseImgUrl + res
				console.log(this.codeImg)
			},
			async init() {
				let res = await this.$u.api.companyRecordDetails({
					recordId: this.recordId
				})
				this.details = res
				console.log(res, '企业档案详情')
			},
			handShare() {

			}
		}
	}
</script>

<style lang="scss" scoped>
	.company-file-details {
		padding: 46rpx 30rpx;
	}
</style>
